﻿using J.Model;
using J.ProductGet.Application.Command.ReleaseAppointmentCommand;
using MediatR;
using SqlSugar;

namespace J.ProductGet.Application.CommandHandler.ReleaseAppointmentCommandHandler
{
    public class ReleaseAppointmentBackilCommandHandler : IRequestHandler<ReleaseAppointmentBackilCommand, List<ReleaseAppointment>>
    {
        private readonly ISqlSugarClient _sqlSugarClient;
        public ReleaseAppointmentBackilCommandHandler(ISqlSugarClient sqlSugarClient)
        {
            _sqlSugarClient = sqlSugarClient;
        }
        public async Task<List<ReleaseAppointment>> Handle(ReleaseAppointmentBackilCommand request, CancellationToken cancellationToken)
        {
            return await _sqlSugarClient.Queryable<ReleaseAppointment>().Where(s => s.ReservationID == request.ReservationID).ToListAsync();
        }
    }
}
